/***************************************************************************
 *	@file 		fetion_listener.h
 *	@Author 	baoyu0125@gmail.com
 *	@create		2011-7
 *	@version 	1.0.0
 *	@brief		definition of class FetionListener, which contain function of
 *				sip listen.
 *	@modify		none
 ***************************************************************************/

#ifndef FETION_LISTENER_H
#define FETION_LISTENER_H

using boost::asio::ip::tcp;

class FetionSip;
class SipProc;

class FetionListener
{
public:
	enum { BUF_LEN = 20480 };
	FetionListener(boost::asio::io_service &io, FetionSip *sip); 

private:
	void clear();
	void handle_sip_listen(const boost::system::error_code& error, std::size_t bytes_transferred);
	void add_sip_recv(const std::string &msg);
	int distribute_sipmsg();

private:
	boost::asio::io_service& io_service_;
	FetionSip *sip_;
	std::vector<SipProc*> sipRecvList;
	char msgBuf[BUF_LEN];
	std::string recvMsg;
};

#endif
